Skip to content

Preintern some TyKind::Bound values #144434

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 27, 2025

Conversation

nnethercote
Copy link
Contributor

@nnethercote nnethercote commented Jul 25, 2025

The new trait solver produces a lot of these.

r? @compiler-errors

- Cover `DebruijnIndex(2)`, for slightly better coverage.
- Rename some things, to account for other region things that were
  renamed.
We already do the same thing for bound regions. This is a small perf win
for the new trait solver.
@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jul 25, 2025
@nnethercote
Copy link
Contributor Author

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors
Copy link

rust-bors bot commented Jul 25, 2025

⌛ Trying commit 837b610 with merge 06fbedc

To cancel the try build, run the command @bors try cancel.

rust-bors bot added a commit that referenced this pull request Jul 25, 2025
@rust-bors
Copy link

rust-bors bot commented Jul 25, 2025

☀️ Try build successful (CI)
Build commit: 06fbedc (06fbedc70773f4b817a3a111c862cd846e4706c5, parent: b56aaec52bc0fa35591a872fb4aac81f606e265c)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (06fbedc): comparison URL.

Overall result: ✅ improvements - no action needed

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

@bors rollup=never
@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
0.2% [0.2%, 0.2%] 1
Regressions ❌
(secondary)
0.2% [0.2%, 0.2%] 1
Improvements ✅
(primary)
-0.3% [-0.5%, -0.1%] 17
Improvements ✅
(secondary)
-0.7% [-1.7%, -0.1%] 25
All ❌✅ (primary) -0.3% [-0.5%, 0.2%] 18

Max RSS (memory usage)

Results (primary 0.4%, secondary -2.6%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
3.1% [3.1%, 3.1%] 1
Regressions ❌
(secondary)
3.3% [3.3%, 3.3%] 1
Improvements ✅
(primary)
-2.4% [-2.4%, -2.4%] 1
Improvements ✅
(secondary)
-3.6% [-6.7%, -1.2%] 6
All ❌✅ (primary) 0.4% [-2.4%, 3.1%] 2

Cycles

Results (secondary 2.2%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.2% [0.8%, 3.5%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 469.891s -> 470.107s (0.05%)
Artifact size: 374.63 MiB -> 374.66 MiB (0.01%)

@lqd
Copy link
Member

lqd commented Jul 25, 2025

(note about results: I saw in other PRs that a handful of benchmarks are currently bimodal)

@nnethercote
Copy link
Contributor Author

nnethercote commented Jul 25, 2025

The new-solver benchmark wins are all real, they are the target of the change and I saw them locally:

image

The new trait solver produces a lot more Bound types. They are mostly produced by the call to Ty::new_anon_bound at the bottom of Canonicalizer::cached_fold_ty. Could there be a deeper optimization that would avoid the need to create these types at all, rather than making them cheaper to create? That would be nice...

@rustbot
Copy link
Collaborator

rustbot commented Jul 25, 2025

compiler-errors is not on the review rotation at the moment.
They may take a while to respond.

@nnethercote
Copy link
Contributor Author

r? @lcnr

@rustbot rustbot assigned lcnr and unassigned compiler-errors Jul 25, 2025
Copy link
Member

@compiler-errors compiler-errors left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this still a draft? I think that this is fine for now.

@compiler-errors
Copy link
Member

Could there be a deeper optimization that would avoid the need to create these types at all, rather than making them cheaper to create? That would be nice...

This seems pretty difficult and probably not worth blocking this on that.

@nnethercote nnethercote marked this pull request as ready for review July 25, 2025 23:14
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 25, 2025
@nnethercote
Copy link
Contributor Author

Correct, this no longer needs to be a draft.

This seems pretty difficult and probably not worth blocking this on that.

Ok. Any time I do a shallow "make operation X faster" micro-optimization I always wonder if there is a deeper and better "avoid operation X altogether" change that could be done instead.

@nnethercote
Copy link
Contributor Author

I think that this is fine for now.

I'll take that as an r+.

@bors r=compiler-errors

@bors
Copy link
Collaborator

bors commented Jul 27, 2025

📌 Commit 837b610 has been approved by compiler-errors

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 27, 2025
@bors
Copy link
Collaborator

bors commented Jul 27, 2025

⌛ Testing commit 837b610 with merge f8e355c...

@compiler-errors
Copy link
Member

I'll take that as an r+.

Yep 👍

@bors
Copy link
Collaborator

bors commented Jul 27, 2025

☀️ Test successful - checks-actions
Approved by: compiler-errors
Pushing f8e355c to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jul 27, 2025
@bors bors merged commit f8e355c into rust-lang:master Jul 27, 2025
12 checks passed
@rustbot rustbot added this to the 1.90.0 milestone Jul 27, 2025
Copy link
Contributor

What is this? This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.

Comparing 4b596bb (parent) -> f8e355c (this PR)

Test differences

Show 7 test diffs

7 doctest diffs were found. These are ignored, as they are noisy.

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard f8e355c230c6eb7b78ffce6a92fd81f78c890524 --output-dir test-dashboard

And then open test-dashboard/index.html in your browser to see an overview of all executed tests.

Job duration changes

  1. dist-apple-various: 8220.5s -> 6696.8s (-18.5%)
  2. x86_64-apple-1: 7902.8s -> 9031.8s (14.3%)
  3. aarch64-gnu-llvm-19-1: 3867.7s -> 3500.7s (-9.5%)
  4. dist-ohos-x86_64: 4452.9s -> 4052.9s (-9.0%)
  5. dist-aarch64-apple: 5950.0s -> 5493.3s (-7.7%)
  6. dist-x86_64-apple: 9275.3s -> 8604.9s (-7.2%)
  7. x86_64-msvc-ext2: 5840.4s -> 5473.7s (-6.3%)
  8. tidy: 101.9s -> 108.2s (6.2%)
  9. dist-android: 2503.6s -> 2657.6s (6.2%)
  10. x86_64-gnu-llvm-19: 2630.4s -> 2772.9s (5.4%)
How to interpret the job duration changes?

Job durations can vary a lot, based on the actual runner instance
that executed the job, system noise, invalidated caches, etc. The table above is provided
mostly for t-infra members, for simpler debugging of potential CI slow-downs.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (f8e355c): comparison URL.

Overall result: ❌✅ regressions and improvements - please read the text below

Our benchmarks found a performance regression caused by this PR.
This might be an actual regression, but it can also be just noise.

Next Steps:

  • If the regression was expected or you think it can be justified,
    please write a comment with sufficient written justification, and add
    @rustbot label: +perf-regression-triaged to it, to mark the regression as triaged.
  • If you think that you know of a way to resolve the regression, try to create
    a new PR with a fix for the regression.
  • If you do not understand the regression or you think that it is just noise,
    you can ask the @rust-lang/wg-compiler-performance working group for help (members of this group
    were already notified of this PR).

@rustbot label: +perf-regression
cc @rust-lang/wg-compiler-performance

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
0.1% [0.1%, 0.1%] 1
Regressions ❌
(secondary)
0.8% [0.3%, 1.0%] 8
Improvements ✅
(primary)
-0.3% [-0.4%, -0.1%] 4
Improvements ✅
(secondary)
-0.9% [-1.7%, -0.2%] 23
All ❌✅ (primary) -0.2% [-0.4%, 0.1%] 5

Max RSS (memory usage)

Results (primary -0.1%, secondary 1.4%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
1.5% [0.8%, 2.6%] 3
Regressions ❌
(secondary)
1.4% [1.3%, 1.5%] 2
Improvements ✅
(primary)
-1.8% [-3.1%, -1.1%] 3
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.1% [-3.1%, 2.6%] 6

Cycles

Results (primary 3.2%, secondary 3.1%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
3.2% [3.2%, 3.2%] 1
Regressions ❌
(secondary)
3.1% [2.8%, 3.5%] 3
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 3.2% [3.2%, 3.2%] 1

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 466.325s -> 465.942s (-0.08%)
Artifact size: 376.81 MiB -> 376.74 MiB (-0.02%)

@rustbot rustbot added the perf-regression Performance regression. label Jul 27, 2025
@Mark-Simulacrum Mark-Simulacrum added the perf-regression-triaged The performance regression has been triaged. label Jul 29, 2025
@Mark-Simulacrum
Copy link
Member

match-stress regression looks plausibly like bimodality to me. ucd and unicode-normalization look more real but are small in magnitude and limited in which scenarios are affected; overall the change remains positive, so marking as triaged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. perf-regression Performance regression. perf-regression-triaged The performance regression has been triaged. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants